cmake_minimum_required(VERSION 3.5)

set(GIT_COMMIT_HASH "")
set(GIT_BRANCH_NAME "")
find_package(Git QUIET)
if(GIT_FOUND)
execute_process(
    #Format %ci time yyyy-mm-dd hh:mm:ss %H commitID
    COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:%ci%H
    OUTPUT_VARIABLE GIT_COMMIT_HASH
    OUTPUT_STRIP_TRAILING_WHITESPACE
    ERROR_QUIET
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
execute_process(
    COMMAND ${GIT_EXECUTABLE} symbolic-ref --short -q HEAD
    OUTPUT_VARIABLE GIT_BRANCH_NAME
    OUTPUT_STRIP_TRAILING_WHITESPACE
    ERROR_QUIET
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif()
set(APP_VERSION "VersionInfo: ${GIT_BRANCH_NAME}:${GIT_COMMIT_HASH}")
message(STATUS  ${APP_VERSION})

project(StringSplitTest)

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/output)

add_subdirectory(src)

include_directories(${PROJECT_SOURCE_DIR}/include)
link_directories(${EXECUTABLE_OUTPUT_PATH}/lib)

aux_source_directory(${PROJECT_SOURCE_DIR}/test TEST_SRC)
add_executable(StringSplitTest ${TEST_SRC})
set(DEPENDLIBS string_split)

target_link_libraries(StringSplitTest ${DEPENDLIBS})